﻿<UserControl
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
	xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:OPDSViewerProtoScreens" xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity" xmlns:pi="http://schemas.microsoft.com/prototyping/2010/interactivity" xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions" x:Name="Catalog_Name"
	mc:Ignorable="d"
	x:Class="OPDSViewerProtoScreens.Catalog"
	Width="640" Height="480" Background="#FFCAC8C8">
	<UserControl.Resources>
		<ResourceDictionary>
			<ResourceDictionary.MergedDictionaries>
				<ResourceDictionary Source="ProjectDataSources.xaml"/>
			</ResourceDictionary.MergedDictionaries>
			<DataTemplate x:Key="ItemTemplate">
				<StackPanel Orientation="Horizontal">
					<CheckBox IsChecked="{Binding ToDownload}" Style="{DynamicResource CheckBox-Sketch}"/>
					<TextBlock Text="{Binding Title}" Style="{DynamicResource BasicTextBlock-Sketch}"/>
				</StackPanel>
			</DataTemplate>
		</ResourceDictionary>
	</UserControl.Resources>
	<i:Interaction.Triggers>
		<i:EventTrigger EventName="Loaded">
			<ei:SetDataStoreValueAction TargetObject="{Binding Mode=OneWay, Source={StaticResource DataStore}}" PropertyName="IsVisualEnabled" Value="True"/>
		</i:EventTrigger>
	</i:Interaction.Triggers>

	<Grid x:Name="LayoutRoot" Background="#FFD6D6D6" DataContext="{Binding Source={StaticResource BookCollection}}">
		<Grid.ColumnDefinitions>
			<ColumnDefinition Width="0.617*"/>
			<ColumnDefinition Width="0.383*"/>
		</Grid.ColumnDefinitions>
		<VisualStateManager.VisualStateGroups>
			<VisualStateGroup x:Name="SearchContainer">
				<VisualStateGroup.Transitions>
					<VisualTransition GeneratedDuration="0">
						<Storyboard>
							<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)" Storyboard.TargetName="SearchGrid">
								<EasingDoubleKeyFrame KeyTime="0" Value="-1"/>
							</DoubleAnimationUsingKeyFrames>
							<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)" Storyboard.TargetName="SearchGrid">
								<EasingDoubleKeyFrame KeyTime="0" Value="-5"/>
							</DoubleAnimationUsingKeyFrames>
						</Storyboard>
					</VisualTransition>
					<VisualTransition From="Open" GeneratedDuration="0:0:0.5" To="Close">
						<Storyboard>
							<DoubleAnimation Duration="0:0:0.5" To="-180" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)" Storyboard.TargetName="SearchGrid"/>
							<DoubleAnimation Duration="0:0:0.5" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)" Storyboard.TargetName="SearchGrid"/>
						</Storyboard>
					</VisualTransition>
					<VisualTransition From="Close" GeneratedDuration="0:0:0.5" To="Open">
						<Storyboard>
							<DoubleAnimation Duration="0:0:0.5" To="0" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)" Storyboard.TargetName="SearchGrid"/>
							<DoubleAnimation Duration="0:0:0.5" To="-3" Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)" Storyboard.TargetName="SearchGrid"/>
						</Storyboard>
					</VisualTransition>
				</VisualStateGroup.Transitions>
				<VisualState x:Name="Close">
					<Storyboard>
						<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)" Storyboard.TargetName="SearchGrid">
							<EasingDoubleKeyFrame KeyTime="0" Value="-180"/>
						</DoubleAnimationUsingKeyFrames>
					</Storyboard>
				</VisualState>
				<VisualState x:Name="Open">
					<Storyboard>
						<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.X)" Storyboard.TargetName="SearchGrid">
							<EasingDoubleKeyFrame KeyTime="0" Value="0"/>
						</DoubleAnimationUsingKeyFrames>
						<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)" Storyboard.TargetName="SearchGrid">
							<EasingDoubleKeyFrame KeyTime="0" Value="-3"/>
						</DoubleAnimationUsingKeyFrames>
					</Storyboard>
				</VisualState>
			</VisualStateGroup>
		</VisualStateManager.VisualStateGroups>
		<VisualStateManager.CustomVisualStateManager>
			<ei:ExtendedVisualStateManager/>
		</VisualStateManager.CustomVisualStateManager>
		<local:HeaderComponent VerticalAlignment="Top" d:LayoutOverrides="Height" Grid.ColumnSpan="2" Panel.ZIndex="5"/>
		<StackPanel Margin="137,55,109.01,0" VerticalAlignment="Top" Orientation="Horizontal" d:LayoutOverrides="Width" Panel.ZIndex="10">
			<TextBlock Style="{DynamicResource BasicTextBlock-Sketch}" Text="Home" TextDecorations="Underline" Foreground="#FF9B9B9B">
				<i:Interaction.Triggers>
					<i:EventTrigger EventName="MouseLeftButtonDown">
						<pi:NavigateToScreenAction TargetScreen="OPDSViewerProtoScreens.Home_1"/>
					</i:EventTrigger>
				</i:Interaction.Triggers>
			</TextBlock>
			<TextBlock Style="{DynamicResource BasicTextBlock-Sketch}" Text=" - " Foreground="#FF9B9B9B"/>
			<TextBlock Style="{DynamicResource BasicTextBlock-Sketch}" Text="Silberfab's catalog" Foreground="#FF9B9B9B"/>
		</StackPanel>
		<Grid x:Name="SearchGrid" Margin="0,139,191,74" RenderTransformOrigin="0.5,0.5" IsEnabled="False" Panel.ZIndex="10">
			<i:Interaction.Triggers>
				<i:EventTrigger EventName="MouseLeftButtonDown">
					<i:Interaction.Behaviors>
						<ei:ConditionBehavior>
							<ei:ConditionalExpression>
								<ei:ComparisonCondition LeftOperand="{Binding IsVisualEnabled, Source={StaticResource DataStore}}" RightOperand="True"/>
							</ei:ConditionalExpression>
						</ei:ConditionBehavior>
					</i:Interaction.Behaviors>
					<ei:GoToStateAction StateName="Close"/>
					<ei:SetDataStoreValueAction PropertyName="IsVisualEnabled" TargetObject="{Binding Mode=OneWay, Source={StaticResource DataStore}}" Value="False"/>
				</i:EventTrigger>
				<i:EventTrigger EventName="MouseLeftButtonDown">
					<i:Interaction.Behaviors>
						<ei:ConditionBehavior>
							<ei:ConditionalExpression>
								<ei:ComparisonCondition LeftOperand="{Binding IsVisualEnabled, Source={StaticResource DataStore}}" RightOperand="False"/>
							</ei:ConditionalExpression>
						</ei:ConditionBehavior>
					</i:Interaction.Behaviors>
					<ei:GoToStateAction StateName="Open"/>
					<ei:SetDataStoreValueAction PropertyName="IsVisualEnabled" TargetObject="{Binding Mode=OneWay, Source={StaticResource DataStore}}" Value="True"/>
				</i:EventTrigger>
			</i:Interaction.Triggers>
			<Grid.RenderTransform>
				<TransformGroup>
					<ScaleTransform/>
					<SkewTransform/>
					<RotateTransform/>
					<TranslateTransform/>
				</TransformGroup>
			</Grid.RenderTransform>
			<Border BorderBrush="Black" CornerRadius="0,25,25,0">
				<Border.Background>
					<RadialGradientBrush>
						<GradientStop Color="#FF858585"/>
						<GradientStop Color="#FF646464"/>
						<GradientStop Color="#FF333333" Offset="1"/>
					</RadialGradientBrush>
				</Border.Background>
				<TextBlock Text="&gt;" Foreground="#FFF9F9F9" HorizontalAlignment="Right" VerticalAlignment="Center" FontSize="32"/>
			</Border>
		</Grid>
		<Grid Grid.Column="1">
			<Border BorderBrush="Black" BorderThickness="0" Background="#FF898181" Margin="0,0,0,8" CornerRadius="0,0,0,20">
				<Grid >
					<ListBox x:Name="listBox" Style="{DynamicResource ListBox-Sketch}" Margin="11,89,9,49" DataContext="{Binding}" ItemTemplate="{DynamicResource ItemTemplate}" ItemsSource="{Binding Collection}"/>
					<Button Content="Download" Height="27" Margin="0,0,9,8" Style="{DynamicResource Button-Sketch}" VerticalAlignment="Bottom" HorizontalAlignment="Right" Width="121">
						<i:Interaction.Triggers>
							<i:EventTrigger EventName="Click">
								<pi:NavigateToScreenAction TargetScreen="OPDSViewerProtoScreens.Download"/>
							</i:EventTrigger>
						</i:Interaction.Triggers>
					</Button>
				</Grid>
			</Border>
		</Grid>
		<Image Margin="65,123,195,0" Source="{Binding SelectedItem.CoverUrl, ElementName=listBox}" Height="180" VerticalAlignment="Top"/>
		<StackPanel HorizontalAlignment="Right" Margin="0,123,8,200" Width="183">
			<TextBlock Margin="0" Style="{DynamicResource BasicTextBlock-Sketch}" Text="{Binding SelectedItem.Title, ElementName=listBox}"/>
			<TextBlock Margin="0" Style="{DynamicResource BasicTextBlock-Sketch}" Text="{Binding SelectedItem.Author, ElementName=listBox}" FontSize="13.333" FontStyle="Italic"/>
		</StackPanel>
		<StackPanel Margin="65,307,8,8">
			<TextBlock Margin="0" Style="{DynamicResource BasicTextBlock-Sketch}" Text="Summary"/>
			<TextBlock Margin="0" Style="{DynamicResource BasicTextBlock-Sketch}" TextWrapping="Wrap" Text="{Binding SelectedItem.Summary, ElementName=listBox}" FontSize="13.333" FontStyle="Italic" MaxHeight="105"/>
			<Button Content="Mark" HorizontalAlignment="Right" Height="33" Style="{DynamicResource Button-Sketch}" Width="109" HorizontalContentAlignment="Left" VerticalAlignment="Bottom"/>
		</StackPanel>
	</Grid>
</UserControl>